<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        报修管理
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../css/main.css" media="all">
    <style>
        .imgs{display: none;}
    </style>

</head>
<body>

<div class="x-body">
    <form class="layui-form layui-form-pane" action="" id="add">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <div class="layui-tab-content" >
                <div class="layui-tab-item layui-show">
                    <input type="hidden" name="id" value="${exception.id}">

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>发起人
                        </label>
                        <div class="layui-input-inline">
                            <input type="hidden" value="${exception.sponsorId}" name="sponsorId">
                            <input type="text" name="name" autocomplete="off" class="layui-input" disabled="disabled" value="${exception.sponsor.name}">
                        </div>
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>发起时间
                        </label>
                        <div class="layui-input-inline">
                            <c:if test="${not empty exception.startTime}">
                                <input type="text" name="start_time" autocomplete="off" placeholder="" class="layui-input" disabled="disabled" value="<fmt:formatDate value="${exception.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>">
                            </c:if>
                            <c:if test="${empty exception.startTime}">
                                <input type="text" name="start_time" autocomplete="off" placeholder="" class="layui-input" disabled="disabled" value="空">
                            </c:if>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>处理人
                        </label>
                        <div class="layui-input-inline">
                            <input type="hidden" value="${exception.handleId}" name="handleId">
                            <input type="text" name="name" autocomplete="off" class="layui-input" disabled="disabled" value="哈哈哈">
                        </div>
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>处理时间
                        </label>
                        <div class="layui-input-inline">
                            <c:if test="${not empty exception.beginHandleTime}">
                                <input type="text" name="start_time" autocomplete="off" placeholder="" class="layui-input" disabled="disabled" value="<fmt:formatDate value="${exception.beginHandleTime}" pattern="yyyy-MM-dd HH:mm:ss"/>">
                            </c:if>
                            <c:if test="${empty exception.beginHandleTime}">
                                <input type="text" name="start_time" autocomplete="off" placeholder="" class="layui-input" disabled="disabled" value="空">
                            </c:if>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>修理人
                        </label>
                        <div class="layui-input-inline">
                            <select name="laborerId" id="laborerId">
                                <c:forEach items="${users}" var="user">
                                    <option value="${user.id}" <c:if test="${user.id == exception.laborerId}">selected</c:if> >${user.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>修理时间
                        </label>
                        <div class="layui-input-inline">
                            <c:if test="${not empty exception.endHandleTime}">
                                <input type="text" name="start_time" autocomplete="off" placeholder="" class="layui-input" disabled="disabled" value="<fmt:formatDate value="${exception.endHandleTime}" pattern="yyyy-MM-dd HH:mm:ss"/>">
                            </c:if>
                            <c:if test="${empty exception.endHandleTime}">
                                <input type="text" name="start_time" autocomplete="off" placeholder="" class="layui-input" disabled="disabled" value="空">
                            </c:if>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>状态
                        </label>

                        <div class="layui-input-block">
                            <input type="radio" name="status" value="0" title="未处理" <c:if test="${exception.status == 0}">checked</c:if>>
                            <div class="layui-unselect layui-form-radio layui-form-radioed">
                                <i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                                <div>待受理</div>
                            </div>
                            <input type="radio" name="status" value="1" title="处理中" <c:if test="${exception.status == 1}">checked</c:if>>
                            <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                <div>已受理</div>
                            </div>
                            <input type="radio" name="status" value="2" title="已处理" <c:if test="${exception.status == 2}">checked</c:if>>
                            <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                <div>已维修</div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>报修描述
                        </label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入内容" name="describes" class="layui-textarea" disabled style="background-color: #F2F2F2">${exception.describes}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <button class="layui-btn" type="button" lay-filter="add" lay-submit="">
                            提交
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<script src="/lib/layui/layui.js" charset="utf-8"></script>
<script src="/js/x-layui.js" charset="utf-8"></script>
<script src="/js/jquery.min.js" charset="utf-8"></script>
<script>
    layui.use(['laydate','element','layer','form'], function(){
        $ = layui.jquery;//jquery
        lement = layui.element();//面包导航
        layer = layui.layer;//弹出层
        form = layui.form();
        laydate = layui.laydate;//日期插件
        form.render();

        //监听提交
        form.on('submit(add)', function(data){
            var data=data.field;
            $.ajax({
                type:"post",
                url:"updateException.action",
                data:data,
                dataType:"json",
                success:function(data){
                    if(data.status==1) {
                        layer.msg(data.info, {icon: 6,time:2000},function () {
                            window.parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                        return false;
                    }else{
                        layer.msg(data.info,{icon:5,time:2000});return false;
                    }
                }
            });
        });
    })
</script>
</body>
</html>